package com.android.jogomemoria;

import java.util.List;

import com.android.jogomemoria.R.layout;

import android.app.ListActivity;
import android.os.Bundle;
//import android.text.Layout;
import android.widget.ArrayAdapter;
//import android.widget.ListView;
import android.widget.Toast;

public class Rank extends ListActivity {
	private RepositorioJogo repositorio;
	List<String> arrayString;
	Jogo[] jogos;
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		super.onCreate(savedInstanceState);
		//setContentView(R.layout.rank);
		try
		{
			repositorio = new RepositorioJogo(this);
			//arrayString = new String[10];
			//arrayString= new String[]{
			
			arrayString = this.repositorio.listarTodosJogos();
			for( String s:arrayString){
				System.out.println(s);
			}
			
			//ListView ltvRank = (ListView)findViewById(R.id.ltvRank);
			
			
			ArrayAdapter<String> arrayAdapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, arrayString);
			setListAdapter(arrayAdapter);
			//ltvRank.setAdapter(arrayAdapter);
		}
		catch(Exception ex)
		{
			Toast.makeText(this, "Erro ao listar Rank!", Toast.LENGTH_SHORT).show();
		}
		
	}
	
	public void finish() {
		super.finish();
	}
	
}
